<!-- 屈光发育档案/检查信息管理(特殊检查) -->
<template>
  <div class="mod-config">
    <div class="avue-crud">
      <el-divider>双眼视功能</el-divider>
      <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="80px" :disabled="formType == 'check'">
        <table class="miui-table">
          <tr>
            <td width="120px">Worth4 dots</td>
            <td>
              <el-form-item prop="worth4Dots" label-width="0">
                <el-select v-model="dataForm.worth4Dots" placeholder="请选择" clearable>
                  <el-option :value="2" label="2"></el-option>
                  <el-option :value="3" label="3"></el-option>
                  <el-option :value="4" label="4"></el-option>
                  <el-option :value="5" label="5"></el-option>
                </el-select>
              </el-form-item>
            </td>
            <td>立体视</td>
            <td>
              <el-form-item prop="stereopsis" label-width="0">
                <el-input v-model="dataForm.stereopsis">
                  <template slot="append">弧秒</template>
                </el-input>
              </el-form-item>
            </td>
            <td>AC/A值</td>
            <td>
              <el-form-item prop="aca" label-width="0">
                <el-input v-model="dataForm.aca"></el-input>
              </el-form-item>
            </td>
            <td>NRA</td>
            <td>
              <el-input v-model="dataForm.nra">
                <template slot="append">D</template>
              </el-input>
            </td>
          </tr>
          <tr>
            <td width="110px">远距离水平隐斜</td>
            <td style="text-align: left;">
              <el-form-item label-width="0">
                <el-input v-model="dataForm.longOblique" style="width: 100px"></el-input>
                <el-select v-model="dataForm.longObliqueInfo" placeholder="请选择" style="width: 100px!important;" clearable>
                  <el-option :value="1" label="BI"></el-option>
                  <el-option :value="2" label="BO"></el-option>
                </el-select>
              </el-form-item>
            </td>
            <td>近距离水平隐斜</td>
            <td style="text-align: left;">
              <el-form-item label-width="0">
                <el-input v-model="dataForm.shortOblique" style="width: 100px"></el-input>
                <el-select v-model="dataForm.shortObliqueInfo" placeholder="请选择" style="width: 100px!important;" clearable>
                  <el-option :value="1" label="BI"></el-option>
                  <el-option :value="2" label="BO"></el-option>
                </el-select>
              </el-form-item>
            </td>
            <td>BCC</td>
            <td>
              <el-form-item prop="bcc" label-width="0">
                <el-input v-model="dataForm.bcc"></el-input>
              </el-form-item>
            </td>
            <td>PRA</td>
            <td>
              <el-form-item prop="pra" label-width="0">
                <el-input v-model="dataForm.pra"></el-input>
              </el-form-item>
            </td>
          </tr>
        </table>
        <el-row>
          <el-col :span="12">
            <table class="miui-table">
              <tr>
                <td rowspan="2">远距离融像功能</td>
                <td>
                  <el-input style="width: 150px;" v-model="dataForm.longBi01" placeholder="球镜"></el-input>
                  /
                  <el-input style="width: 150px;" v-model="dataForm.longBi02" placeholder="柱镜"></el-input>
                  /
                  <el-input style="width: 150px;" v-model="dataForm.longBi03" placeholder="轴向"></el-input>
                </td>
              </tr>
              <tr>
                <td>
                  <el-input style="width: 150px;" v-model="dataForm.longBo01" placeholder="球镜"></el-input>
                  /
                  <el-input style="width: 150px;" v-model="dataForm.longBo02" placeholder="柱镜"></el-input>
                  /
                  <el-input style="width: 150px;" v-model="dataForm.longBo03" placeholder="轴向"></el-input>
                </td>
              </tr>
            </table>
          </el-col>
          <el-col :span="12">
            <table class="miui-table">
              <tr>
                <td rowspan="2">近距离融像功能</td>
                <td>
                  <el-input style="width: 150px;" v-model="dataForm.shortBi01" placeholder="球镜"></el-input>
                  /
                  <el-input style="width: 150px;" v-model="dataForm.shortBi02" placeholder="柱镜"></el-input>
                  /
                  <el-input style="width: 150px;" v-model="dataForm.shortBi03" placeholder="轴向"></el-input>
                </td>

              </tr>
              <tr>
                <td>
                  <el-input style="width: 150px;" v-model="dataForm.shortBo01" placeholder="球镜"></el-input>
                  /
                  <el-input style="width: 150px;" v-model="dataForm.shortBo02" placeholder="柱镜"></el-input>
                  /
                  <el-input style="width: 150px;" v-model="dataForm.shortBo03" placeholder="轴向"></el-input>
                </td>
              </tr>
            </table>
          </el-col>
        </el-row>
        <el-row>
          <table class="miui-table">
            <tr>
              <td rowspan="2">调节灵活度</td>
              <td>
                <el-form-item label="视标" prop="eyeNorm">
                  <el-select v-model="dataForm.eyeNorm" placeholder="请选择" clearable>
                    <el-option :value="1" label="20/30"></el-option>
                    <el-option :value="2" label="20/40"></el-option>
                    <el-option :value="3" label="20/50"></el-option>
                  </el-select>
                </el-form-item>
              </td>
              <td>
                <el-form-item label="双面镜度数" prop="ouGlasses" label-width="100px">
                  <el-select v-model="dataForm.ouGlasses" placeholder="请选择" clearable>
                    <el-option :value="1" label="±1.00"></el-option>
                    <el-option :value="2" label="±1.50"></el-option>
                    <el-option :value="3" label="±2.00"></el-option>
                    <el-option :value="4" label="±2.50"></el-option>
                  </el-select>
                </el-form-item>
              </td>
              <td></td>
            </tr>
            <tr>
              <td>
                <el-input v-model="dataForm.adjustOd" style="width: 300px">
                  <template slot="prepend"> OD: </template>
                  <template slot="append"> CPM fail </template>
                </el-input>
                <el-select v-model="dataForm.adjustOdFail" placeholder="请选择" style="width: 100px!important;" clearable>
                  <el-option :value="1" label="+"></el-option>
                  <el-option :value="2" label="-"></el-option>
                </el-select>
              </td>
              <td>
                <el-input v-model="dataForm.adjustOs" style="width: 300px">
                  <template slot="prepend"> OD: </template>
                  <template slot="append"> CPM fail </template>
                </el-input>
                <el-select v-model="dataForm.adjustOsFail" placeholder="请选择" style="width: 100px!important;" clearable>
                  <el-option :value="1" label="+"></el-option>
                  <el-option :value="2" label="-"></el-option>
                </el-select>
              </td>
              <td>
                <el-input v-model="dataForm.adjustOu" style="width: 300px">
                  <template slot="prepend"> OD: </template>
                  <template slot="append"> CPM fail </template>
                </el-input>
                <el-select v-model="dataForm.adjustOuFail" placeholder="请选择" style="width: 100px!important;" clearable>
                  <el-option :value="1" label="+"></el-option>
                  <el-option :value="2" label="-"></el-option>
                </el-select>
              </td>
            </tr>
          </table>
        </el-row>
        <el-row>
          <el-form-item label="双眼视功能评估" prop="ouAssessment" label-width="110px">
            <!-- <el-input v-model="dataForm.ouAssessment" placeholder="双眼视功能评估"></el-input> -->
            <el-select v-model="dataForm.ouAssessment" placeholder="请选择" style="width: 200px!important;" clearable>
              <el-option :value="1" label="正常"></el-option>
              <el-option :value="2" label="调节不足/滞后"></el-option>
              <el-option :value="3" label="调节灵敏度异常"></el-option>
              <el-option :value="4" label="调节过度/超前"></el-option>
              <el-option :value="5" label="集合不足"></el-option>
              <el-option :value="6" label="集合过度"></el-option>
              <el-option :value="7" label="散开不足"></el-option>
              <el-option :value="8" label="散开过度"></el-option>
              <el-option :value="9" label="运动异常"></el-option>
              <el-option :value="10" label="基本型内隐斜"></el-option>
              <el-option :value="11" label="基本型外隐斜"></el-option>
            </el-select>
          </el-form-item>
        </el-row>
        <el-divider></el-divider>
        <el-row>
          <table class="miui-table">
            <tr>
              <td width="100px"></td>
              <td colspan="3" style="text-align: center;">右眼</td>
              <td colspan="3" style="text-align: center;">左眼</td>
            </tr>
            <tr>
              <td>泪液破裂时间</td>
              <td colspan="3">
                <el-input v-model="dataForm.graphics.tearsRuptureTimeOd" placeholder="右眼泪液破裂时间(sec)">
                  <template slot="append">
                    sec
                  </template>
                </el-input>
              </td>
              <td colspan="3">
                <el-input v-model="dataForm.graphics.tearsRuptureTimeOs" placeholder="左眼泪液破裂时间(sec)">
                  <template slot="append"> sec </template>
                </el-input>
              </td>
            </tr>
            <tr>
              <td rowspan="2">角膜地形图</td>
              <td>
                <el-input v-model="dataForm.graphics.minkOd">
                  <template slot="prepend"> Mink: </template>
                </el-input>
              </td>
              <td>
                <el-input v-model="dataForm.graphics.tkOd">
                  <template slot="prepend"> TK: </template>
                </el-input>
              </td>
              <td>
                <el-input v-model="dataForm.graphics.ksOd">
                  <template slot="prepend"> Ks: </template>
                </el-input>
              </td>
              <td>
                <el-input v-model="dataForm.graphics.minkOs">
                  <template slot="prepend"> Mink: </template>
                </el-input>
              </td>
              <td>
                <el-input v-model="dataForm.graphics.tkOs">
                  <template slot="prepend"> TK: </template>
                </el-input>
              </td>
              <td>
                <el-input v-model="dataForm.graphics.ksOs">
                  <template slot="prepend"> Ks: </template>
                </el-input>
              </td>
            </tr>
            <tr>
              <td>
                <el-input v-model="dataForm.graphics.kfOd">
                  <template slot="prepend"> Kf: </template>
                </el-input>
              </td>
              <td>
                <el-input v-model="dataForm.graphics.pdOd">
                  <template slot="prepend"> 瞳孔直径: </template>
                </el-input>
              </td>
              <td width="300px">
                <el-input v-model="dataForm.graphics.flatEOd" style="width: 180px;float: left;" placeholder="平面e值">
                  <template slot="prepend"> e值: </template>
                </el-input>
                <el-input v-model="dataForm.graphics.eOd" style="width: 100px;float: right;" placeholder="斜面e值"></el-input>
              </td>
              <td>
                <el-input v-model="dataForm.graphics.kfOs">
                  <template slot="prepend"> Kf: </template>
                </el-input>
              </td>
              <td>
                <el-input v-model="dataForm.graphics.pdOs">
                  <template slot="prepend"> 瞳孔直径: </template>
                </el-input>
              </td>
              <td width="300px">
                <el-input v-model="dataForm.graphics.flatEOs" style="width: 180px;float: left;" placeholder="平面e值">
                  <template slot="prepend"> e值: </template>
                </el-input>
                <el-input v-model="dataForm.graphics.eOs" style="width: 100px;float: right;" placeholder="斜面e值"></el-input>
              </td>
            </tr>
            <tr>
              <td>角膜内皮计数</td>
              <td colspan="3">
                <el-input v-model="dataForm.graphics.ceOd" placeholder="右眼眼角膜内皮计数(个/mm2)">
                  <template slot="append"> 个/mm2 </template>
                </el-input>
              </td>
              <td colspan="3">
                <el-input v-model="dataForm.graphics.ceOs" placeholder="左眼角膜内皮计数(个/mm2)">
                  <template slot="append"> 个/mm2 </template>
                </el-input>
              </td>
            </tr>
          </table>
        </el-row>
      </el-form>
    </div>
  </div>
</template>

<script>
  import {
    getPvmArcSpecialCheckObj,
    addPvmArcSpecialCheckObj,
    putPvmArcSpecialCheckObj,
    getInfoByOptometryId
  } from '@/api/pvm/arcspecialcheck'

  export default {
    data() {
      return {
        visible: false,
        formType: '',
        dataForm: {
          id: 0,
          optometryId: '',
          personId: '',
          worth4Dots: '',
          stereopsis: '',
          aca: '',
          nra: '',
          longOblique: '',
          longObliqueInfo: '',
          shortOblique: '',
          shortObliqueInfo: '',
          bcc: '',
          pra: '',
          longBi01: '',
          longBi02: '',
          longBi03: '',
          longBo01: '',
          longBo02: '',
          longBo03: '',
          shortBi01: '',
          shortBi02: '',
          shortBi03: '',
          shortBo01: '',
          shortBo02: '',
          shortBo03: '',
          eyeNorm: '',
          ouGlasses: '',
          adjustOd: '',
          adjustOdFail: '',
          adjustOs: '',
          adjustOsFail: '',
          adjustOu: '',
          adjustOuFail: '',
          ouAssessment: '',
          graphics: {
            tearsRuptureTimeOd: '',
            tearsRuptureTimeOs: '',
            minkOd: '',
            minkOs: '',
            tkOd: '',
            tkOs: '',
            ksOd: '',
            ksOs: '',
            kfOd: '',
            kfOs: '',
            pdOd: '',
            pdOs: '',
            eod: '',
            eos: '',
            ceOd: '',
            ceOs: ''
          }
        },
        dataRule: {
          // optometryId: [
          //   { required: true, message: '三维检查id不能为空', trigger: 'blur' }
          // ],
          // personId: [
          //   { required: true, message: '人员id不能为空', trigger: 'blur' }
          // ],
          // worth4Dots: [
          //   { required: true, message: '不能为空', trigger: 'blur' }
          // ],
          // stereopsis: [
          //   { required: true, message: '立体视不能为空', trigger: 'blur' }
          // ],
          // aca: [
          //   { required: true, message: 'AC/A值不能为空', trigger: 'blur' }
          // ],
          // nra: [
          //   { required: true, message: 'NRA不能为空', trigger: 'blur' }
          // ],
          // longOblique: [
          //   { required: true, message: '远距离水平隐斜不能为空', trigger: 'blur' }
          // ],
          // longObliqueInfo: [
          //   { required: true, message: '远距离水平隐斜信息不能为空', trigger: 'blur' }
          // ],
          // shortOblique: [
          //   { required: true, message: '近距离水平隐斜不能为空', trigger: 'blur' }
          // ],
          // shortObliqueInfo: [
          //   { required: true, message: '近距离水平隐斜信息不能为空', trigger: 'blur' }
          // ],
          // bcc: [
          //   { required: true, message: 'BCC不能为空', trigger: 'blur' }
          // ],
          // pra: [
          //   { required: true, message: 'PRA不能为空', trigger: 'blur' }
          // ],
          // longBi01: [
          //   { required: true, message: '远距离融像功能BI01不能为空', trigger: 'blur' }
          // ],
          // longBi02: [
          //   { required: true, message: '远距离融像功能BI02不能为空', trigger: 'blur' }
          // ],
          // longBi03: [
          //   { required: true, message: '远距离融像功能BI03不能为空', trigger: 'blur' }
          // ],
          // longBo01: [
          //   { required: true, message: '远距离融像功能BO01不能为空', trigger: 'blur' }
          // ],
          // longBo02: [
          //   { required: true, message: '远距离融像功能BO02不能为空', trigger: 'blur' }
          // ],
          // longBo03: [
          //   { required: true, message: '远距离融像功能BO03不能为空', trigger: 'blur' }
          // ],
          // shortBi01: [
          //   { required: true, message: '近距离融像功能BI01不能为空', trigger: 'blur' }
          // ],
          // shortBi02: [
          //   { required: true, message: '近距离融像功能BI02不能为空', trigger: 'blur' }
          // ],
          // shortBi03: [
          //   { required: true, message: '近距离融像功能BI03不能为空', trigger: 'blur' }
          // ],
          // shortBo01: [
          //   { required: true, message: '近距离融像功能BO01不能为空', trigger: 'blur' }
          // ],
          // shortBo02: [
          //   { required: true, message: '近距离融像功能BO02不能为空', trigger: 'blur' }
          // ],
          // shortBo03: [
          //   { required: true, message: '近距离融像功能BO03不能为空', trigger: 'blur' }
          // ],
          // eyeNorm: [
          //   { required: true, message: '视标不能为空', trigger: 'blur' }
          // ],
          // ouGlasses: [
          //   { required: true, message: '	双面镜度数不能为空', trigger: 'blur' }
          // ],
          // adjustOd: [
          //   { required: true, message: '调节灵活度OD不能为空', trigger: 'blur' }
          // ],
          // adjustOdFail: [
          //   { required: true, message: '调节灵活度ODFAIL不能为空', trigger: 'blur' }
          // ],
          // adjustOs: [
          //   { required: true, message: '调节灵活度OS不能为空', trigger: 'blur' }
          // ],
          // adjustOsFail: [
          //   { required: true, message: '调节灵活度OSFAIL不能为空', trigger: 'blur' }
          // ],
          // adjustOu: [
          //   { required: true, message: '调节灵活度OU不能为空', trigger: 'blur' }
          // ],
          // adjustOuFail: [
          //   { required: true, message: '调节灵活度OUFAIL不能为空', trigger: 'blur' }
          // ],
          // ouAssessment: [
          //   { required: true, message: '双眼视功能评估不能为空', trigger: 'blur' }
          // ]
        }
      }
    },
    methods: {
      init(formType,optometryId) {
        this.formType = formType
        this.dataForm.optometryId = optometryId
        this.visible = true
        this.$nextTick(() => {
          if (this.dataForm.optometryId) {
            getInfoByOptometryId(this.dataForm.optometryId).then(response => {
							if(response.data.code == '0'){
								this.dataForm = response.data.data
								if (!response.data.data.graphics) {
								  this.dataForm.graphics = {}
								}
							}else{
								this.$message.error(response.data.msg)
							}
            })
          } else {
            for (let key in this.dataForm) {
              if (key == 'graphics') {
                this.dataForm.graphics = {}
              } else {
                this.dataForm[key] = ""
              }
            }
          }
        })
      },
      // 表单提交
      dataFormSubmit() {
        this.$refs['dataForm'].validate((valid) => {
          if (valid) {
            if (this.dataForm.id) {
              putPvmArcSpecialCheckObj(this.dataForm).then(response => {
								if(response.data.code == '0'){
									this.$message.success('修改成功')
									this.visible = false
									this.$emit('refreshDataList')
								}else{
									this.$message.error(response.data.msg)
								}
              })
            } else {
              addPvmArcSpecialCheckObj(this.dataForm).then(response => {
                if(response.data.code == '0'){
                	this.$message.success('添加成功')
                	this.visible = false
                	this.$emit('refreshDataList')
                }else{
                	this.$message.error(response.data.msg)
                }
              })
            }
          }
        })
      }
    }
  }
</script>
<style lang="scss" scoped>
  .bg-row {
    // background-color: #cadee8;
    padding-left: 15px;
    padding-top: 5px;
  }

  .miui-table {
    width: 100%;
    margin: 10px 0;
    // background-color: #b1e2ec3b;

    tr th {
      background-color: #f4f5f7;
    }

    tr th,
    tr td {
      padding: 10px 8px;
      border: solid 1px #fff;
      text-align: center;
    }

    .miui-table-header td {
      background-color: #7898a8;
      color: #fff;
      text-align: center;
    }

    .miui-table-tbody {
      background-color: #cadee8;
    }
  }
</style>
